package AC;
import java.util.InputMismatchException;
import java.util.Scanner;
public class Caidan {
    public static void main(String[] args) {
        System.out.println("1.登陆    2.注册   3.联系客服");
        while (true) {
            int a =0;
            double b = 0;
            Scanner in = new Scanner(System.in);
            System.out.print("请输入你的选择：");
            try {
                if(in.hasNextInt()){
                    a=in.nextInt();
                    if(a>=1&&a<=3){
                        switch (a) {
                            case 1:
                                System.out.println("登陆成功！");
                                return;
                            case 2:
                                System.out.println("注册成功！");
                                return;
                            case 3:
                                System.out.println("客服电话是99999");
                                return;
                        }
                    }else {
                        throw new Exception("请输入1-3之间的数字！");
                    }
                }else if(in.hasNextDouble()){
                    throw new Exception("请输入整数！");
                }else {
                    throw new Exception("请输入数字！");
                }
            } catch (Exception e){
                System.out.println(e.getMessage());
            }
        }
    }
}
